<%@ page contentType="text/html;charset=UTF-8"%>
<!-- basic scripts -->

<!--[if !IE]> -->
<script type="text/javascript">
	window.jQuery || document.write("<script src='${ctx}/static/ace/js/jquery.js'>" + "<"+"/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='${ctx}/static/ace/js/jquery1x.js'>"+"<"+"/script>");
</script>
<![endif]-->
<script type="text/javascript">
	if ('ontouchstart' in document.documentElement)
		document.write("<script src='${ctx}/static/ace/js/jquery.mobile.custom.js'>" + "<"+"/script>");
</script>
<script src="${ctx}/static/bootstrap/bootstrap.js"></script>
<script src="${ctx}/static/bootstrap-contextmenu/bootstrap-contextmenu.js"></script>
<!-- page specific plugin scripts -->

<!--[if lte IE 8]>
		  <script src="${ctx}/static/ace/js/excanvas.js"></script>
		<![endif]-->
<script src="${ctx}/static/ace/js/jquery-ui.js"></script>
<script src="${ctx}/static/ace/js/jquery-ui.custom.js"></script>
<script src="${ctx}/static/ace/js/jquery.ui.touch-punch.js"></script>

<!-- ace scripts -->
<script src="${ctx}/static/ace/js/ace/elements.scroller.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.colorpicker.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.fileinput.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.typeahead.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.wysiwyg.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.spinner.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.treeview.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.wizard.js"></script>
<script src="${ctx}/static/ace/js/ace/elements.aside.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.js"></script>
<script src="${ctx}/static/ace/js/ace-extra.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.ajax-content.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.touch-drag.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.sidebar.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.sidebar-scroll-1.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.submenu-hover.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.widget-box.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.settings.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.settings-rtl.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.settings-skin.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.widget-on-reload.js"></script>
<script src="${ctx}/static/ace/js/ace/ace.searchbox-autocomplete.js"></script>

<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->
<!--[if lte IE 8]>
		<script src="${ctx}/static/ace/js/html5shiv.js"></script>
		<script src="${ctx}/static/ace/js/respond.js"></script>
		<![endif]-->

<script type="text/javascript">
	jQuery(function($) {
		//And for the first simple table, which doesn't have TableTools or dataTables
		//select/deselect all rows according to table header checkbox
		var active_class = 'active';
		$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function() {
			var th_checked = this.checked;//checkbox inside "TH" table header

			$(this).closest('table').find('tbody > tr').each(function() {
				var row = this;
				if (th_checked)
					$(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
				else
					$(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
			});
		});

		//select/deselect a row when the checkbox is checked/unchecked
		$('#simple-table').on('click', 'td input[type=checkbox]', function() {
			var $row = $(this).closest('tr');
			if (this.checked)
				$row.addClass(active_class);
			else
				$row.removeClass(active_class);
		});

		$("#simple-table .btn").tooltip({
			hide : {
				effect : "explode",
				delay : 250
			},
			show : {
				effect : "slideDown",
				delay : 250
			}
		});
	});
</script>